<template>
<div class="wrapper">
  <swiper :options="swiperOption" v-if="showSwiper">
    <!-- slides -->
    <swiper-slide v-for='item of swiperList' :key="item.id">
      <img class="swipe-img" :src='item.imgUrl'>
    </swiper-slide>
    <!-- Optional controls -->
    <div class="swiper-pagination swp1"  slot="pagination"></div>
  </swiper>
</div>
</template>

<script type="text/javascript">
export default{
  name: 'HomeSwiper',
  props: {
    swiperList: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'bullets'
      }
    }
  },
  computed: {
    showSwiper () {
      return this.swiperList.length
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '~styles/varibles.styl'
.wrapper >>> .swiper-pagination-bullet-active
  background:#fff
.wrapper
  touch-action: none;
  overflow:hidden
  width:100%
  height:0
  padding-bottom:31.25%
  background:$qianhui
  .swipe-img
    width:100%
  .swp1
    touch-action: none
    color: #fff
</style>
